#include<iostream>
#include<string>
using namespace std;
typedef long long LL;
const int N = 7e4 + 10;
int s1[N];
int n;
string s;
int main()
{
	cin >> n >> s;
	LL ans = 0;
	LL cnt = 0;
	//int cnt_0 = 0;
	//int cnt_00 = 0;
	//int ans1 = 0;
	for (int i = 0; i < s.size(); i++) {
		int x = s[i] - '0';
		//if (x == 0)cnt_0++;
		if (x % 2 == 0) {
			ans += cnt;
			ans++;
		}
		cnt++;
		/*if (x == 0) {
			cnt_00++;
		}
		else {
			ans1 += cnt_00;
			cnt_00 = 0;
		}*/
	}
	//if (cnt_0 == n)cout << n << endl;
	cout << ans << endl;
	return 0;
}